package com.yeqian;


import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;


@Slf4j
@EnableAsync   //开启异步注解功能
@SpringBootApplication(scanBasePackages = {"com.yeqian"})
@MapperScan(basePackages = {"com.yeqian.mapper", "com.yeqian.*.mapper"})
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
public class WebApplication  {
    public static void main(String[] args) {
        ConfigurableApplicationContext run = SpringApplication.run(WebApplication.class, args);
        printSystemInfo(run);
    }

    private static void printSystemInfo(ApplicationContext applicationContext) {
        Environment environment = applicationContext.getEnvironment();
        String port = environment.getProperty("server.port"),
                context = environment.getProperty("server.servlet.context-path"),
                ip = "localhost",
                systemIndexUrl = "http://" + ip + ":" + port + context;
        log.info("================ 初始化系统,项目启动===================");
        log.info(">>>>>>>>>>>>>>>>>>>>项目地址:" + systemIndexUrl + " >>>>>>>>>");
    }

}
